
/*****************************************************************************
*   ioconfig.h:  me32G serial header file for io function selection
*		ver 1.0
******************************************************************************/
#define	IOCONFIG_ENABLE			0x1  						//Enable Select function
#define	IOCONFIG_DISABLE		0x0							//Disable Select function

#define	PA0_GPIO						0x290	  				//Select function PA0
#define	PA0_SPI1_SCK				0x291						//Select function SPI1_SCK
#define	PA0_UART1_CTS				0x292						//Select function UART1_CTS
#define	PA0_CTIM0_CAP0			0x293						//Select function CTIM0_CAP0
#define	PA0_CTIM0_MAT0			0x294						//Select function CTIM0_MAT0
#define	PA0_UART3_TX				0x295    				//Select function UART3_TX
#define	PA0_CMP0_OUT				0x296    				//Select function CMP0_OUT
#define	PA0_ADC0						0x187	          //Select function ADC0
#define	PA0_CMP_IN0					0x187	          //Select function CMP_IN0
			
#define	PA1_GPIO						0x290	   				//Select function PA1 
#define	PA1_SPI0_SCK				0x291						//Select function SPI0_SCK 
#define	PA1_UART1_RTS				0x292						//Select function UART1_RTS
#define	PA1_CTIM0_CAP1			0x293    				//Select function CTIM0_CAP1
#define	PA1_CTIM0_MAT1			0x294						//Select function CTIM0_MAT1
#define	PA1_UART3_RX				0x295						//Select function UART3_RX
#define	PA1_BTIM1_MAT0N			0x296						//Select function BTIM1_MAT0N
#define	PA1_ADC1						0x187	          //Select function ADC1
#define	PA1_CMP_IN1					0x187	          //Select function CMP_IN1
			
#define	PA2_GPIO						0x290	         	//Select function PA2
#define	PA2_SPI0_MOSI				0x291	        	//Select function SPI0_MOSI
#define	PA2_UART1_TX				0x292						//Select function UART1_TX
#define	PA2_CTIM0_CAP2			0x293						//Select function CTIM0_CAP2
#define	PA2_CTIM0_MAT2			0x294    				//Select function CTIM0_MAT2
#define	PA2_BTIM1_MAT0			0x295    				//Select function BTIM1_MAT0
#define	PA2_ADC2						0x187	          //Select function ADC2
#define	PA2_CMP_IN2					0x187	          //Select function CMP_IN2
			
#define	PA3_GPIO						0x290	          //Select function PA3  
#define	PA3_SPI1_MISO 			0x291	        	//Select function SPI1_MISO
#define	PA3_UART1_RX				0x292	  				//Select function UART1_RX
#define	PA3_CTIM0_CAP3			0x293						//Select function CTIM0_CAP3
#define	PA3_CTIM0_MAT3			0x294						//Select function CTIM0_MAT3 
#define	PA3_BTIM1_MAT0			0x295						//Select function BTIM1_MAT0 
#define	PA3_ADC3						0x187	          //Select function ADC3
#define	PA3_CMP_IN3					0x187	          //Select function CMP_IN3	
			
#define	PA4_GPIO						0x290	         	//Select function PA4 
#define	PA4_SPI0_NSS				0x291	         	//Select function SPI0_NSS
#define	PA4_SPI1_MOSI				0x292 					//Select function SPI1_MOSI
#define	PA4_BTIM0_MAT0			0x293						//Select function BTIM0_MAT0
#define	PA4_CTIM0_CAP2			0x294						//Select function CTIM0_CAP2
#define	PA4_CTIM0_MAT2			0x295						//Select function CTIM0_MAT2
#define	PA4_ADC4						0x187	          //Select function ADC4
			
#define	PA5_GPIO						0x290	          //Select function PA5 
#define	PA5_SPI0_SCK				0x291	         	//Select function SPI0_SCK
#define	PA5_UART2_TX				0x292	        	//Select function UART2_TX
#define	PA5_CTIM0_CAP0			0x293						//Select function CTIM0_CAP0
#define	PA5_CTIM0_MAT0			0x294						//Select function CTIM0_MAT0
#define	PA5_ADC5						0x187	          //Select function ADC5
			
#define	PA6_GPIO						0x290	          //Select function PA6
#define	PA6_SPI0_MISO				0x291	         	//Select function SPI0_MISO
#define	PA6_UART2_CTS				0x292	        	//Select function UART2_CTS
#define	PA6_CTIM1_CAP0			0x293						//Select function CTIM1_CAP0
#define	PA6_CTIM1_MAT0			0x294      			//Select function CTIM1_MAT0
#define	PA6_PWM_FAULT				0x295	    			//Select function PWM_FAULT
#define	PA6_CMP1_OUT				0x296 	  			//Select function CMP1_OUT
#define	PA6_ADC6						0x187	          //Select function ADC6
			
#define	PA7_GPIO						0x290 	        //Select function PA7
#define	PA7_SPI0_MOSI				0x291	         	//Select function SPI0_MOSI
#define	PA7_CTIM1_CAP1			0x292	        	//Select function CTIM1_CAP1
#define	PA7_CTIM1_MAT1			0x293						//Select function CTIM1_MAT1
#define	PA7_PWM1						0x294 	    		//Select function PWM1
#define	PA7_BTIM0_MAT0N			0x295 	  			//Select function BTIM0_MAT0N
#define	PA7_BTIM3_MAT0			0x296	    			//Select function BTIM3_MAT0
#define	PA7_ADC7						0x187	          //Select function ADC7
			
#define	PA8_GPIO						0x290	          //Select function PA8
#define	PA8_SPI1_NSS				0x291						//Select function SPI1_NSS
#define	PA8_CTIM1_CAP3			0x292	          //Select function CTIM1_CAP3
#define	PA8_CTIM1_MAT3			0x293	          //Select function CTIM1_MAT3
#define	PA8_PWM0						0x295	        	//Select function PWM0

#define	PA9_GPIO						0x290 	        //Select function PA9 
#define	PA9_SPI1_MISO				0x291	         	//Select function SPI1_MISO
#define	PA9_UART0_TX				0x292	          //Select function UART0_TX
#define	PA9_PWM2						0x293	          //Select function PWM2
#define	PA9_I2C0_SCL				0x295 	        //Select function I2C0_SCL
			
#define	PA10_GPIO						0x290 	      	//Select function PA10 
#define	PA10_SPI1_MOSI			0x291	         	//Select function SPI1_MOSI
#define	PA10_UART0_RX				0x292	          //Select function UART0_RX
#define	PA10_PWM2						0x293    				//Select function PWM2
#define	PA10_PWM4						0x294	          //Select functionPWM4
#define	PA10_I2C0_SDA				0x295    				//Select functionI2C0_SDA

#define	PA11_GPIO						0x290	          //Select function PA11 
#define	PA11_SPI0_MISO			0x291	         	//Select function SPI0_MISO
#define	PA11_UART0_CTS			0x292	          //Select function UART0_CTS
#define	PA11_PWM6						0x293	          //Select function PWM6
#define	PA11_PWM_FAULT			0x294    				//Select function PWM_FAULT
#define	PA11_I2C1_SCL				0x295    				//Select function I2C1_SCL
#define	PA11_CTIM0_CAP2			0x296    				//Select function CTIM0_CAP2	

#define	PA12_GPIO						0x290	          //Select function PA12 
#define	PA12_SPI0_MOSI			0x291	         	//Select function SPI0_MOSI
#define	PA12_UART0_RTS			0x292	          //Select function UART0_RTS
#define	PA12_I2C1_SDA				0x295	          //Select function I2C1_SDA
#define	PA12_CMP1_OUT				0x296    				//Select function CMP1_OUT

#define	PA13_SWDIO					0x290	         	//Select function SWDIO 
#define	PA13_GPIO						0x291	         	//Select function PA13 

#define	PA14_SWDCLK 				0x290						//Select function SWDCLK 
#define	PA14_GPIO						0x291	  				//Select function PA14
#define	PA14_UART1_TX				0x292    				//Select function UART1_TX
#define	PA14_CTIM0_CAP0			0x293 	  			//Select function CTIM0_CAP0	 
	
#define	PA15_GPIO						0x290	         	//Select function PA15
#define	PA15_SPI0_NSS				0x291	          //Select functionSPI0_NSS
#define	PA15_UART1_RX				0x292	     			//Select function UART1_RX	
#define	PA15_UART3_RTS			0x295 	  			//Select function UART3_RTS 
#define	PA15_UART2_RTS			0x296	    			//Select function UART2_RTS
			
#define	PB0_GPIO						0x290	          //Select function PB0
#define	PB0_SPI0_NSS				0x291						//Select function SPI0_NSS
#define	PB0_UART2_RX				0x292	        	//Select function UART2_RX
#define	PB0_CTIM1_CAP2			0x293 	  			//Select function CTIM1_CAP2
#define	PB0_CTIM1_MAT2			0x294	    			//Select function CTIM1_MAT2
#define	PB0_PWM3						0x295 	  			//Select function PWM3
#define	PB0_CMP0_OUT				0x296	    			//Select function CMP0_OUT
			
#define	PB1_GPIO						0x290	          //Select function PB1
#define	PB1_UART2_RTS				0x291						//Select function UART2_RTS
#define	PB1_BTIM0_MAT0N			0x293	        	//Select function BTIM0_MAT0N	
#define	PB1_CTIM1_CAP3			0x294	   				//Select function CTIM1_CAP3	 
#define	PB1_CTIM1_MAT3			0x295	    			//Select function CTIM1_MAT3
#define	PB1_PWM5						0x296	          //Select function PWM5

#define	PB2_GPIO						0x290 	   			//Select function PB2
#define	PB2_SPI1_MISO				0x291						//Select function SPI1_MISO
#define	PB2_UART2_TX				0x292	        	//Select function UART2_TX
			
#define	PB3_GPIO						0x290	     			//Select function PB3 
#define	PB3_SPI0_SCK				0x291	    			//Select function SPI0_SCK
#define	PB3_PWM2						0x292	          //Select function PWM2
#define	PB3_CTIM0_CAP1			0x293						//Select function CTIM0_CAP1
#define	PB3_CTIM0_MAT1			0x294	        	//Select function CTIM0_MAT1
#define	PB3_UART0_RTS				0x295 	  			//Select function UART0_RTS 
#define	PB3_CMP_IN4					0x187    				//Select function CMP_IN4

#define	PB4_GPIO						0x290	     			//Select function PB4 
#define	PB4_SPI0_MISO				0x291	    			//Select function SPI0_MISO	
#define	PB4_CTIM1_CAP0			0x292	          //Select function CTIM1_CAP0
#define	PB4_CTIM1_MAT0			0x293 	        //Select function CTIM1_MAT0
#define	PB4_UART0_CTS 			0x294 	    		//Select function UART0_CTS 
#define	PB4_CMP_IN5					0x187    				//Select function CMP_IN5

#define	PB5_GPIO						0x290	          //Select function PB5 
#define	PB5_SPI0_MOSI				0x291	    			//Select function SPI0_MOSI
#define	PB5_CTIM1_CAP1			0x292	        	//Select function CTIM1_CAP1
#define	PB5_CTIM1_MAT1 			0x293      			//Select function CTIM1_MAT1 
#define	PB5_CMP1_OUT				0x296	      		//Select function CMP1_OUT
			
#define	PB6_GPIO						0x290	          //Select function PB6
#define	PB6_SPI1_MISO				0x291	    			//Select functionSPI1_MISO
#define	PB6_UART0_TX				0x292	          //Select function UART0_TX
#define	PB6_PWM4						0x293	          //Select function PWM4
#define	PB6_BTIM2_MAT0N			0x294	        	//Select function BTIM2_MAT0N
#define	PB6_I2C0_SCL				0x296	        	//Select function I2C0_SCL
#define	PB6_CMP_IN6					0x187    				//Select function CMP_IN6

#define	PB7_GPIO						0x290	          //Select function PB7 
#define	PB7_SPI1_MOSI				0x291	          //Select function SPI1_MOSI
#define	PB7_UART0_RX				0x292	          //Select function UART0_RX
#define	PB7_UART3_CTS				0x293          	//Select function UART3_CTS 
#define	PB7_BTIM3_MAT0N			0x294	        	//Select function BTIM3_MAT0N	
#define	PB7_IR_OUT1					0x295    				//Select function IR_OUT1
#define	PB7_I2C0_SDA				0x296	          //Select function I2C0_SDA
#define	PB7_CMP_IN7					0x187    				//Select function CMP_IN7

#define	PB8_GPIO						0x290	          //Select function PB8
#define	PB8_SPI1_SCK				0x291	    			//Select function SPI1_SCK
#define	PB8_UART2_TX				0x292    				//Select function UART2_TX
#define	PB8_BTIM2_MAT0			0x293	          //Select function BTIM2_MAT0 
#define	PB8_CTIM1_CAP2			0x294	        	//Select function CTIM1_CAP2
#define	PB8_CTIM1_MAT2			0x295    				//Select function CTIM1_MAT2
#define	PB8_I2C0_SCL				0x296    				//Select function I2C0_SCL

#define	PB9_GPIO						0x290	          //Select function PB9 
#define	PB9_SPI1_NSS				0x291	    			//Select function SPI1_NSS
#define	PB9_UART2_RX				0x292	          //Select function UART2_RX
#define	PB9_BTIM3_MAT0			0x293	        	//Select function BTIM3_MAT0
#define	PB9_IR_OUT0					0x294    				//Select function IR_OUT0
#define	PB9_IR_OUT1					0x295    				//Select function IR_OUT1
#define	PB9_I2C0_SDA				0x296   				//Select function I2C0_SDA

#define	PB10_GPIO						0x290	     			//Select function PB10 
#define	PB10_CTIM0_CAP2			0x292	          //Select function CTIM0_CAP2
#define	PB10_CTIM0_MAT2			0x293						//Select function CTIM0_MAT2
#define	PB10_UART2_TX				0x294 	 				//Select function UART2_TX
#define	PB10_SPI1_SCK				0x295	  				//Select function SPI1_SCK 
#define	PB10_I2C1_SCL				0x296	    			//Select function I2C1_SCL
			
#define	PB11_GPIO						0x290	    			//Select function PB11 
#define	PB11_SPI1_MOSI			0x291	          //Select function SPI1_MOSI
#define	PB11_CTIM0_CAP3			0x293 	 				//Select function CTIM0_CAP3
#define	PB11_CTIM0_MAT3			0x294 	 				//Select function CTIM0_MAT3
#define	PB11_UART2_RX 			0x295	  				//Select function UART2_RX
#define	PB11_I2C1_SDA				0x296	    			//Select function I2C1_SDA
			
#define	PB12_GPIO						0x290	    			//Select function PB12 
#define	PB12_SPI1_NSS				0x291	    			//Select function SPI1_NSS
#define	PB12_PWM_FAULT 			0x293						//Select function PWM_FAULT
			
#define	PB13_GPIO						0x290 	  			//Select function PB13
#define	PB13_SPI1_SCK				0x291	    			//Select function SPI1_SCK
#define	PB13_PWM1						0x293	  				//Select function PWM1
#define	PB13_UART2_CTS			0x294						//Select function UART2_CTS
#define	PB13_BTIM1_MAT0N		0x295	  				//Select function BTIM1_MAT0N
#define	PB13_I2C1_SCL				0x296						//Select function I2C1_SCL

#define	PB14_GPIO						0x290	          //Select function PB14 
#define	PB14_SPI1_MISO			0x291	    			//Select function SPI1_MISO
#define	PB14_UART2_RTS			0x292	          //Select function UART2_RTS
#define	PB14_CTIM0_CAP3			0x293	  				//Select function CTIM0_CAP3
#define	PB14_BTIM1_MAT0			0x294						//Select function BTIM1_MAT0
#define	PB14_I2C1_SDA				0x295	  				//Select function I2C1_SDA	
#define	PB14_PWM3						0x296						//Select function PWM3

#define	PB15_GPIO						0x290 	        //Select function PB15 
#define	PB15_SPI1_MOSI			0x291	    			//Select function SPI1_MOSI
#define	PB15_PWM5						0x292	      		//Select function PWM5 
#define	PB15_BTIM1_MAT0N		0x293	      		//Select function BTIM1_MAT0N
#define	PB15_BTIM1_MAT0			0x294						//Select function BTIM1_MAT0
#define	PB15_CTIM1_CAP3			0x295	      		//Select function CTIM1_CAP3
#define	PB15_CTIM1_MAT3			0x296						//Select function CTIM1_MAT3

#define	PC0_GPIO						0x290	          //Select function PC0
#define	PC0_SPI1_NSS				0x291	    			//Select function SPI1_NSS
#define	PC0_BTIM2_MAT0			0x292	          //Select function BTIM2_MAT0
#define	PC0_SPI0_MOSI				0x295    				//Select function SPI0_MOSI
#define	PC0_SPI0_MISO				0x296	          //Select function SPI0_MISO

#define	PC1_GPIO						0x290	          //Select function PC1
#define	PC1_SPI1_SCK				0x291	    			//Select function SPI1_SCK
#define	PC1_BTIM3_MAT0			0x292	          //Select function BTIM3_MAT0
#define	PC1_SPI0_MISO				0x295	    			//Select function SPI0_MISO
#define	PC1_SPI0_MOSI				0x296	          //Select function SPI0_MOSI	

#define	PC2_GPIO						0x290	          //Select function PC2
#define	PC2_UART2_RTS				0x291	    			//Select function UART2_RTS	
#define	PC2_PWM1						0x294    				//Select function PWM1
#define	PC2_SPI0_SCK				0x295	          //Select function SPI0_SCK
#define	PC2_SPI1_MOSI				0x296    				//Select function SPI1_MOSI

#define	PC3_GPIO						0x290	          //Select function PC3
#define	PC3_SPI1_MISO				0x291	    			//Select function SPI1_MISO
#define	PC3_PWM3						0x293          	//Select function PWM3
#define	PC3_SPI0_NSS				0x295        		//Select function SPI0_NSS

#define	PC4_GPIO						0x290	          //Select function PC4
#define	PC4_BTIM0_MAT0			0x291	          //Select function BTIM0_MAT0

#define	PC5_GPIO						0x290	          //Select function PC5
#define	PC5_BTIM1_MAT0N			0x291	          //Select function BTIM1_MAT0N

#define	PC6_GPIO						0x290	          //Select function PC6
#define	PC6_CTIM1_CAP0 			0x291	  				//Select function CTIM1_CAP0 
#define	PC6_CTIM1_MAT0			0x292	    			//Select function CTIM1_MAT0
#define	PC6_CTIM0_CAP2 			0x293	  				//Select function CTIM0_CAP2
#define	PC6_CTIM0_MAT2			0x294	    			//Select function CTIM0_MAT2

#define	PC7_GPIO						0x290	          //Select function PC7
#define	PC7_CTIM1_CAP1			0x291	  				//Select function CTIM1_CAP1
#define	PC7_CTIM1_MAT1			0x292    				//Select function CTIM1_MAT1
#define	PC7_CTIM0_CAP3			0x293	  				//Select function CTIM0_CAP3
#define	PC7_CTIM0_MAT3			0x294    				//Select function CTIM0_MAT3

#define	PC8_GPIO						0x290	          //Select function PC8 
#define	PC8_PWM0						0x291	  				//Select function TIM3_CAP2 

#define	PC9_NRST						0x290 	        //Select function NRST 
#define	PC9_GPIO 						0x291	  				//Select function GPIO 
			
#define	PC10_GPIO						0x290	          //Select function PC10 
#define	PC10_I2C0_SCL				0x291	          //Select function I2C0_SCL 
#define	PC10_UART2_TX				0x292	          //Select function UART2_TX 
#define	PC10_UART3_TX				0x293	          //Select function UART3_TX
#define	PC10_PWM4						0x294	          //Select function PWM4

#define	PC11_GPIO						0x290 	        //Select function PC11 
#define	PC11_I2C0_SDA				0x291	    			//Select function I2C0_SDA
#define	PC11_UART2_RX				0x292 	        //Select function UART2_RX 
#define	PC11_UART3_RX				0x293	    			//Select function UART3_RX
#define	PC11_PWM6						0x294 	        //Select function PWM6 
			
#define	PC12_GPIO						0x290 	        //Select function PC12

#define	PC13_GPIO						0x290	   				//Select function PC13
#define	PC13_CLKOUT					0x291	          //Select function CLKOUT			
#define	PC13_PWM_FAULT			0x292	          //Select function PWM_FAULT		

#define	PC14_GPIO						0x290           //Select function PC14 
#define	PC14_PWM_FAULT			0x291	          //Select function PWM_FAULT
#define	PC14_UART3_TX				0x293	          //Select function UART3_TX		

#define	PC15_GPIO						0x290	          // Select function PC15 
#define	PC15_UART3_RX				0x293	          //Select function UART3_RX		

//PA IO PINs
#define  PA0_INIT(PA0_function)						IOCON->PA0 = PA0_function
#define  PA0_PULLUP(enable)								IOCON->PA0_b.PUE = enable
#define  PA0_PULLDOWN(enable)							IOCON->PA0_b.PDE = enable
#define  PA1_INIT(PA1_function) 					IOCON->PA1 = PA1_function
#define  PA1_PULLUP(enable)								IOCON->PA1_b.PUE = enable
#define  PA1_PULLDOWN(enable)							IOCON->PA1_b.PDE = enable
#define  PA2_INIT(PA2_function) 					IOCON->PA2 = PA2_function
#define  PA2_PULLUP(enable)								IOCON->PA2_b.PUE = enable
#define  PA2_PULLDOWN(enable)							IOCON->PA2_b.PDE = enable
#define  PA3_INIT(PA3_function) 					IOCON->PA3 = PA3_function
#define  PA3_PULLUP(enable)								IOCON->PA3_b.PUE = enable
#define  PA3_PULLDOWN(enable)							IOCON->PA3_b.PDE = enable
#define  PA4_INIT(PA4_function) 					IOCON->PA4 = PA4_function
#define  PA4_PULLUP(enable)								IOCON->PA4_b.PUE = enable
#define  PA4_PULLDOWN(enable)							IOCON->PA4_b.PDE = enable
#define  PA5_INIT(PA5_function) 					IOCON->PA5 = PA5_function
#define  PA5_PULLUP(enable)								IOCON->PA5_b.PUE = enable
#define  PA5_PULLDOWN(enable)							IOCON->PA5_b.PDE = enable
#define  PA6_INIT(PA6_function) 					IOCON->PA6 = PA6_function
#define  PA6_PULLUP(enable)								IOCON->PA6_b.PUE = enable
#define  PA6_PULLDOWN(enable)							IOCON->PA6_b.PDE = enable
#define  PA7_INIT(PA7_function) 					IOCON->PA7 = PA7_function
#define  PA7_PULLUP(enable)								IOCON->PA7_b.PUE = enable
#define  PA7_PULLDOWN(enable)							IOCON->PA7_b.PDE = enable
#define  PA8_INIT(PA8_function) 					IOCON->PA8 = PA8_function
#define  PA8_PULLUP(enable)								IOCON->PA8_b.PUE = enable
#define  PA8_PULLDOWN(enable)							IOCON->PA8_b.PDE = enable
#define  PA9_INIT(PA9_function) 					IOCON->PA9 = PA9_function
#define  PA9_PULLUP(enable)								IOCON->PA9_b.PUE = enable
#define  PA9_PULLDOWN(enable)							IOCON->PA9_b.PDE = enable
#define  PA10_INIT(PA10_function) 				IOCON->PA10 = PA10_function
#define  PA10_PULLUP(enable)							IOCON->PA10_b.PUE = enable
#define  PA10_PULLDOWN(enable)						IOCON->PA10_b.PDE = enable
#define  PA11_INIT(PA11_function) 				IOCON->PA11 = PA11_function
#define  PA11_PULLUP(enable)							IOCON->PA11_b.PUE = enable
#define  PA11_PULLDOWN(enable)						IOCON->PA11_b.PDE = enable
#define  PA12_INIT(PA12_function) 				IOCON->PA12 = PA12_function
#define  PA12_PULLUP(enable)							IOCON->PA12_b.PUE = enable
#define  PA12_PULLDOWN(enable)						IOCON->PA12_b.PDE = enable
#define  PA13_INIT(PA13_function) 				IOCON->PA13 = PA13_function
#define  PA13_PULLUP(enable)							IOCON->PA13_b.PUE = enable
#define  PA13_PULLDOWN(enable)						IOCON->PA13_b.PDE = enable
#define  PA14_INIT(PA14_function) 				IOCON->PA14 = PA14_function
#define  PA14_PULLUP(enable)							IOCON->PA14_b.PUE = enable
#define  PA14_PULLDOWN(enable)						IOCON->PA14_b.PDE = enable
#define  PA15_INIT(PA15_function) 				IOCON->PA15 = PA15_function
#define  PA15_PULLUP(enable)							IOCON->PA15_b.PUE = enable
#define  PA15_PULLDOWN(enable)						IOCON->PA15_b.PDE = enable
//PB IO PINs
#define  PB0_INIT(PB0_function) 					IOCON->PB0 = PB0_function
#define  PB0_PULLUP(enable)								IOCON->PB0_b.PUE = enable
#define  PB0_PULLDOWN(enable)							IOCON->PB0_b.PDE = enable
#define  PB1_INIT(PB1_function) 					IOCON->PB1 = PB1_function
#define  PB1_PULLUP(enable)								IOCON->PB1_b.PUE = enable
#define  PB1_PULLDOWN(enable)							IOCON->PB1_b.PDE = enable
#define  PB2_INIT(PB2_function) 					IOCON->PB2 = PB2_function
#define  PB2_PULLUP(enable)								IOCON->PB2_b.PUE = enable
#define  PB2_PULLDOWN(enable)							IOCON->PB2_b.PDE = enable
#define  PB3_INIT(PB3_function) 					IOCON->PB3 = PB3_function
#define  PB3_PULLUP(enable)								IOCON->PB3_b.PUE = enable
#define  PB3_PULLDOWN(enable)							IOCON->PB3_b.PDE = enable
#define  PB4_INIT(PB4_function) 					IOCON->PB4 = PB4_function
#define  PB4_PULLUP(enable)								IOCON->PB4_b.PUE = enable
#define  PB4_PULLDOWN(enable)							IOCON->PB4_b.PDE = enable
#define  PB5_INIT(PB5_function) 					IOCON->PB5 = PB5_function
#define  PB5_PULLUP(enable)								IOCON->PB5_b.PUE = enable
#define  PB5_PULLDOWN(enable)							IOCON->PB5_b.PDE = enable
#define  PB6_INIT(PB6_function) 					IOCON->PB6 = PB6_function
#define  PB6_PULLUP(enable)								IOCON->PB6_b.PUE = enable
#define  PB6_PULLDOWN(enable)							IOCON->PB6_b.PDE = enable
#define  PB7_INIT(PB7_function) 					IOCON->PB7 = PB7_function
#define  PB7_PULLUP(enable)								IOCON->PB7_b.PUE = enable
#define  PB7_PULLDOWN(enable)							IOCON->PB7_b.PDE = enable
#define  PB8_INIT(PB8_function) 					IOCON->PB8 = PB8_function
#define  PB8_PULLUP(enable)								IOCON->PB8_b.PUE = enable
#define  PB8_PULLDOWN(enable)							IOCON->PB8_b.PDE = enable
#define  PB9_INIT(PB9_function) 					IOCON->PB9 = PB9_function
#define  PB9_PULLUP(enable)								IOCON->PB9_b.PUE = enable
#define  PB9_PULLDOWN(enable)							IOCON->PB9_b.PDE = enable
#define  PB10_INIT(PB10_function) 				IOCON->PB10 = PB10_function
#define  PB10_PULLUP(enable)							IOCON->PB10_b.PUE = enable
#define  PB10_PULLDOWN(enable)						IOCON->PB10_b.PDE = enable
#define  PB11_INIT(PB11_function) 				IOCON->PB11 = PB11_function
#define  PB11_PULLUP(enable)							IOCON->PB11_b.PUE = enable
#define  PB11_PULLDOWN(enable)						IOCON->PB11_b.PDE = enable
#define  PB12_INIT(PB12_function) 				IOCON->PB12 = PB12_function
#define  PB12_PULLUP(enable)							IOCON->PB12_b.PUE = enable
#define  PB12_PULLDOWN(enable)						IOCON->PB12_b.PDE = enable
#define  PB13_INIT(PB13_function) 				IOCON->PB13 = PB13_function
#define  PB13_PULLUP(enable)							IOCON->PB13_b.PUE = enable
#define  PB13_PULLDOWN(enable)						IOCON->PB13_b.PDE = enable
#define  PB14_INIT(PB14_function) 				IOCON->PB14 = PB14_function
#define  PB14_PULLUP(enable)							IOCON->PB14_b.PUE = enable
#define  PB14_PULLDOWN(enable)						IOCON->PB14_b.PDE = enable
#define  PB15_INIT(PB15_function) 				IOCON->PB15 = PB15_function
#define  PB15_PULLUP(enable)							IOCON->PB15_b.PUE = enable
#define  PB15_PULLDOWN(enable)						IOCON->PB15_b.PDE = enable

//PC IO PINs
#define  PC0_INIT(PC0_function) 					IOCON->PC0 = PC0_function
#define  PC0_PULLUP(enable)								IOCON->PC0_b.PUE = enable
#define  PC0_PULLDOWN(enable)							IOCON->PC0_b.PDE = enable
#define  PC1_INIT(PC1_function) 					IOCON->PC1 = PC1_function
#define  PC1_PULLUP(enable)								IOCON->PC1_b.PUE = enable
#define  PC1_PULLDOWN(enable)							IOCON->PC1_b.PDE = enable
#define  PC2_INIT(PC2_function) 					IOCON->PC2 = PC2_function
#define  PC2_PULLUP(enable)								IOCON->PC2_b.PUE = enable
#define  PC2_PULLDOWN(enable)							IOCON->PC2_b.PDE = enable
#define  PC3_INIT(PC3_function) 					IOCON->PC3 = PC3_function
#define  PC3_PULLUP(enable)								IOCON->PC3_b.PUE = enable
#define  PC3_PULLDOWN(enable)							IOCON->PC3_b.PDE = enable
#define  PC4_INIT(PC4_function) 					IOCON->PC4 = PC4_function
#define  PC4_PULLUP(enable)								IOCON->PC4_b.PUE = enable
#define  PC4_PULLDOWN(enable)							IOCON->PC4_b.PDE = enable
#define  PC5_INIT(PC5_function) 					IOCON->PC5 = PC5_function
#define  PC5_PULLUP(enable)								IOCON->PC5_b.PUE = enable
#define  PC5_PULLDOWN(enable)							IOCON->PC5_b.PDE = enable
#define  PC6_INIT(PC6_function) 					IOCON->PC6 = PC6_function
#define  PC6_PULLUP(enable)								IOCON->PC6_b.PUE = enable
#define  PC6_PULLDOWN(enable)							IOCON->PC6_b.PDE = enable
#define  PC7_INIT(PC7_function) 					IOCON->PC7 = PC7_function
#define  PC7_PULLUP(enable)								IOCON->PC7_b.PUE = enable
#define  PC7_PULLDOWN(enable)							IOCON->PC7_b.PDE = enable
#define  PC8_INIT(PC8_function) 					IOCON->PC8 = PC8_function
#define  PC8_PULLUP(enable)								IOCON->PC8_b.PUE = enable
#define  PC8_PULLDOWN(enable)							IOCON->PC8_b.PDE = enable
#define  PC9_INIT(PC9_function) 					IOCON->PC9 = PC9_function
#define  PC9_PULLUP(enable)								IOCON->PC9_b.PUE = enable
#define  PC9_PULLDOWN(enable)							IOCON->PC9_b.PDE = enable
#define  PC10_INIT(PC10_function) 				IOCON->PC10 = PC10_function
#define  PC10_PULLUP(enable)							IOCON->PC10_b.PUE = enable
#define  PC10_PULLDOWN(enable)						IOCON->PC10_b.PDE = enable
#define  PC11_INIT(PC11_function) 				IOCON->PC11 = PC11_function
#define  PC11_PULLUP(enable)							IOCON->PC11_b.PUE = enable
#define  PC11_PULLDOWN(enable)						IOCON->PC11_b.PDE = enable
#define  PC12_INIT(PC12_function) 				IOCON->PC12 = PC12_function
#define  PC12_PULLUP(enable)							IOCON->PC12_b.PUE = enable
#define  PC12_PULLDOWN(enable)						IOCON->PC12_b.PDE = enable
#define  PC13_INIT(PC13_function) 				IOCON->PC13 = PC13_function
#define  PC13_PULLUP(enable)							IOCON->PC13_b.PUE = enable
#define  PC13_PULLDOWN(enable)						IOCON->PC13_b.PDE = enable
#define  PC14_INIT(PC14_function) 				IOCON->PC14 = PC14_function
#define  PC14_PULLUP(enable)							IOCON->PC14_b.PUE = enable
#define  PC14_PULLDOWN(enable)						IOCON->PC14_b.PDE = enable
#define  PC15_INIT(PC15_function) 				IOCON->PC15 = PC15_function
#define  PC15_PULLUP(enable)							IOCON->PC15_b.PUE = enable
#define  PC15_PULLDOWN(enable)						IOCON->PC15_b.PDE = enable





#define   PA0_OUTPUT   PA->DIR_b.DIR0=1
#define   PA0_INPUT    PA->DIR_b.DIR0=0
#define   PA0_OUTL     PA->CLR_b.CLR0=1
#define   PA0_OUTH     PA->SET_b.SET0=1
#define   PA0_READ     (PA->PIN)&0X01

#define   PA1_OUTPUT   PA->DIR_b.DIR1=1
#define   PA1_INPUT    PA->DIR_b.DIR1=0
#define   PA1_OUTL     PA->CLR_b.CLR1=1
#define   PA1_OUTH     PA->SET_b.SET1=1
#define   PA1_READ     (PA->PIN)&0X02

#define   PA2_OUTPUT   PA->DIR_b.DIR2=1
#define   PA2_INPUT    PA->DIR_b.DIR2=0
#define   PA2_OUTL     PA->CLR_b.CLR2=1
#define   PA2_OUTH     PA->SET_b.SET2=1
#define   PA2_READ     (PA->PIN)&0X04

#define   PA3_OUTPUT   PA->DIR_b.DIR3=1
#define   PA3_INPUT    PA->DIR_b.DIR3=0
#define   PA3_OUTL     PA->CLR_b.CLR3=1
#define   PA3_OUTH     PA->SET_b.SET3=1
#define   PA3_READ     (PA->PIN)&0X08

#define   PA4_OUTPUT   PA->DIR_b.DIR4=1
#define   PA4_INPUT    PA->DIR_b.DIR4=0
#define   PA4_OUTL     PA->CLR_b.CLR4=1
#define   PA4_OUTH     PA->SET_b.SET4=1
#define   PA4_READ     (PA->PIN)&0X10

#define   PA5_OUTPUT   PA->DIR_b.DIR5=1
#define   PA5_INPUT    PA->DIR_b.DIR5=0
#define   PA5_OUTL     PA->CLR_b.CLR5=1
#define   PA5_OUTH     PA->SET_b.SET5=1
#define   PA5_READ     (PA->PIN)&0X20

#define   PA6_OUTPUT   PA->DIR_b.DIR6=1
#define   PA6_INPUT    PA->DIR_b.DIR6=0
#define   PA6_OUTL     PA->CLR_b.CLR6=1
#define   PA6_OUTH     PA->SET_b.SET6=1
#define   PA6_READ     (PA->PIN)&0X40

#define   PA7_OUTPUT   PA->DIR_b.DIR7=1
#define   PA7_INPUT    PA->DIR_b.DIR7=0
#define   PA7_OUTL     PA->CLR_b.CLR7=1
#define   PA7_OUTH     PA->SET_b.SET7=1
#define   PA7_READ     (PA->PIN)&0X80

#define   PA8_OUTPUT   PA->DIR_b.DIR8=1
#define   PA8_INPUT    PA->DIR_b.DIR8=0
#define   PA8_OUTL     PA->CLR_b.CLR8=1
#define   PA8_OUTH     PA->SET_b.SET8=1
#define   PA8_READ     (PA->PIN)&0X100

#define   PA9_OUTPUT   PA->DIR_b.DIR9=1
#define   PA9_INPUT    PA->DIR_b.DIR9=0
#define   PA9_OUTL     PA->CLR_b.CLR9=1
#define   PA9_OUTH     PA->SET_b.SET9=1
#define   PA9_READ     (PA->PIN)&0X200

#define   PA10_OUTPUT   PA->DIR_b.DIR10=1
#define   PA10_INPUT    PA->DIR_b.DIR10=0
#define   PA10_OUTL     PA->CLR_b.CLR10=1
#define   PA10_OUTH     PA->SET_b.SET10=1
#define   PA10_READ     (PA->PIN)&0X400

#define   PA11_OUTPUT   PA->DIR_b.DIR11=1
#define   PA11_INPUT    PA->DIR_b.DIR11=0
#define   PA11_OUTL     PA->CLR_b.CLR11=1
#define   PA11_OUTH     PA->SET_b.SET11=1
#define   PA11_READ     (PA->PIN)&0X800

#define   PA12_OUTPUT   PA->DIR_b.DIR12=1
#define   PA12_INPUT    PA->DIR_b.DIR12=0
#define   PA12_OUTL     PA->CLR_b.CLR12=1
#define   PA12_OUTH     PA->SET_b.SET12=1
#define   PA12_READ     (PA->PIN)&0X1000

#define   PA13_OUTPUT   PA->DIR_b.DIR13=1
#define   PA13_INPUT    PA->DIR_b.DIR13=0
#define   PA13_OUTL     PA->CLR_b.CLR13=1
#define   PA13_OUTH     PA->SET_b.SET13=1
#define   PA13_READ     (PA->PIN)&0X2000

#define   PA14_OUTPUT   PA->DIR_b.DIR14=1
#define   PA14_INPUT    PA->DIR_b.DIR14=0
#define   PA14_OUTL     PA->CLR_b.CLR14=1
#define   PA14_OUTH     PA->SET_b.SET14=1
#define   PA14_READ     (PA->PIN)&0X4000

#define   PA15_OUTPUT   PA->DIR_b.DIR15=1
#define   PA15_INPUT    PA->DIR_b.DIR15=0
#define   PA15_OUTL     PA->CLR_b.CLR15=1
#define   PA15_OUTH     PA->SET_b.SET15=1
#define   PA15_READ     (PA->PIN)&0X8000

#define   PB0_OUTPUT   PB->DIR_b.DIR0=1
#define   PB0_INPUT    PB->DIR_b.DIR0=0
#define   PB0_OUTL     PB->CLR_b.CLR0=1
#define   PB0_OUTH     PB->SET_b.SET0=1
#define   PB0_READ     (PB->PIN)&0X01


#define   PB1_OUTPUT   PB->DIR_b.DIR1=1
#define   PB1_INPUT    PB->DIR_b.DIR1=0
#define   PB1_OUTL     PB->CLR_b.CLR1=1
#define   PB1_OUTH     PB->SET_b.SET1=1
#define   PB1_READ     (PB->PIN)&0X02


#define   PB2_OUTPUT   PB->DIR_b.DIR2=1
#define   PB2_INPUT    PB->DIR_b.DIR2=0
#define   PB2_OUTL     PB->CLR_b.CLR2=1
#define   PB2_OUTH     PB->SET_b.SET2=1
#define   PB2_READ     (PB->PIN)&0X04

#define   PB3_OUTPUT   PB->DIR_b.DIR3=1
#define   PB3_INPUT    PB->DIR_b.DIR3=0
#define   PB3_OUTL     PB->CLR_b.CLR3=1
#define   PB3_OUTH     PB->SET_b.SET3=1
#define   PB3_READ     (PB->PIN)&0X08

#define   PB4_OUTPUT   PB->DIR_b.DIR4=1
#define   PB4_INPUT    PB->DIR_b.DIR4=0
#define   PB4_OUTL     PB->CLR_b.CLR4=1
#define   PB4_OUTH     PB->SET_b.SET4=1
#define   PB4_READ     (PB->PIN)&0X10

#define   PB5_OUTPUT   PB->DIR_b.DIR5=1
#define   PB5_INPUT    PB->DIR_b.DIR5=0
#define   PB5_OUTL     PB->CLR_b.CLR5=1
#define   PB5_OUTH     PB->SET_b.SET5=1
#define   PB5_READ     (PB->PIN)&0X20

#define   PB6_OUTPUT   PB->DIR_b.DIR6=1
#define   PB6_INPUT    PB->DIR_b.DIR6=0
#define   PB6_OUTL     PB->CLR_b.CLR6=1
#define   PB6_OUTH     PB->SET_b.SET6=1
#define   PB6_READ     (PB->PIN)&0X40


#define   PB7_OUTPUT   PB->DIR_b.DIR7=1
#define   PB7_INPUT    PB->DIR_b.DIR7=0
#define   PB7_OUTL     PB->CLR_b.CLR7=1
#define   PB7_OUTH     PB->SET_b.SET7=1
#define   PB7_READ     (PB->PIN)&0X80

#define   PB8_OUTPUT   PB->DIR_b.DIR8=1
#define   PB8_INPUT    PB->DIR_b.DIR8=0
#define   PB8_OUTL     PB->CLR_b.CLR8=1
#define   PB8_OUTH     PB->SET_b.SET8=1
#define   PB8_READ     (PB->PIN)&0X100

#define   PB9_OUTPUT   PB->DIR_b.DIR9=1
#define   PB9_INPUT    PB->DIR_b.DIR9=0
#define   PB9_OUTL     PB->CLR_b.CLR9=1
#define   PB9_OUTH     PB->SET_b.SET9=1
#define   PB9_READ     (PB->PIN)&0X200

#define   PB10_OUTPUT   PB->DIR_b.DIR10=1
#define   PB10_INPUT    PB->DIR_b.DIR10=0
#define   PB10_OUTL     PB->CLR_b.CLR10=1
#define   PB10_OUTH     PB->SET_b.SET10=1
#define   PB10_READ     (PB->PIN)&0X400

#define   PB11_OUTPUT   PB->DIR_b.DIR11=1
#define   PB11_INPUT    PB->DIR_b.DIR11=0
#define   PB11_OUTL     PB->CLR_b.CLR11=1
#define   PB11_OUTH     PB->SET_b.SET11=1
#define   PB11_READ     (PB->PIN)&0X800

#define   PB12_OUTPUT   PB->DIR_b.DIR12=1
#define   PB12_INPUT    PB->DIR_b.DIR12=0
#define   PB12_OUTL     PB->CLR_b.CLR12=1
#define   PB12_OUTH     PB->SET_b.SET12=1
#define   PB12_READ     (PB->PIN)&0X1000


#define   PB13_OUTPUT   PB->DIR_b.DIR13=1
#define   PB13_INPUT    PB->DIR_b.DIR13=0
#define   PB13_OUTL     PB->CLR_b.CLR13=1
#define   PB13_OUTH     PB->SET_b.SET13=1
#define   PB13_READ     (PB->PIN)&0X2000


#define   PB14_OUTPUT   PB->DIR_b.DIR14=1
#define   PB14_INPUT    PB->DIR_b.DIR14=0
#define   PB14_OUTL     PB->CLR_b.CLR14=1
#define   PB14_OUTH     PB->SET_b.SET14=1
#define   PB14_READ     (PB->PIN)&0X4000


#define   PB15_OUTPUT   PB->DIR_b.DIR15=1
#define   PB15_INPUT    PB->DIR_b.DIR15=0
#define   PB15_OUTL     PB->CLR_b.CLR15=1
#define   PB15_OUTH     PB->SET_b.SET15=1
#define   PB15_READ     (PB->PIN)&0X8000


#define   PC0_OUTPUT    PC->DIR_b.DIR0=1
#define   PC0_INPUT     PC->DIR_b.DIR0=0
#define   PC0_OUTL      PC->CLR_b.CLR0=1
#define   PC0_OUTH      PC->SET_b.SET0=1
#define   PC0_READ     (PC->PIN)&0X01


#define   PC1_OUTPUT    PC->DIR_b.DIR1=1
#define   PC1_INPUT     PC->DIR_b.DIR1=0
#define   PC1_OUTL      PC->CLR_b.CLR1=1
#define   PC1_OUTH      PC->SET_b.SET1=1
#define   PC1_READ     (PC->PIN)&0X02


#define   PC2_OUTPUT    PC->DIR_b.DIR2=1
#define   PC2_INPUT     PC->DIR_b.DIR2=0
#define   PC2_OUTL      PC->CLR_b.CLR2=1
#define   PC2_OUTH      PC->SET_b.SET2=1
#define   PC2_READ     (PC->PIN)&0X04

#define   PC3_OUTPUT    PC->DIR_b.DIR3=1
#define   PC3_INPUT     PC->DIR_b.DIR3=0
#define   PC3_OUTL      PC->CLR_b.CLR3=1
#define   PC3_OUTH      PC->SET_b.SET3=1
#define   PC3_READ     (PC->PIN)&0X08


#define   PC4_OUTPUT    PC->DIR_b.DIR4=1
#define   PC4_INPUT     PC->DIR_b.DIR4=0
#define   PC4_OUTL      PC->CLR_b.CLR4=1
#define   PC4_OUTH      PC->SET_b.SET4=1
#define   PC4_READ     (PC->PIN)&0X10


#define   PC5_OUTPUT    PC->DIR_b.DIR5=1
#define   PC5_INPUT     PC->DIR_b.DIR5=0
#define   PC5_OUTL      PC->CLR_b.CLR5=1
#define   PC5_OUTH      PC->SET_b.SET5=1
#define   PC5_READ     (PC->PIN)&0X20


#define   PC6_OUTPUT    PC->DIR_b.DIR6=1
#define   PC6_INPUT     PC->DIR_b.DIR6=0
#define   PC6_OUTL      PC->CLR_b.CLR6=1
#define   PC6_OUTH      PC->SET_b.SET6=1
#define   PC6_READ     (PC->PIN)&0X40



#define   PC7_OUTPUT    PC->DIR_b.DIR7=1
#define   PC7_INPUT     PC->DIR_b.DIR7=0
#define   PC7_OUTL      PC->CLR_b.CLR7=1
#define   PC7_OUTH      PC->SET_b.SET7=1
#define   PC7_READ     (PC->PIN)&0X80


#define   PC8_OUTPUT    PC->DIR_b.DIR8=1
#define   PC8_INPUT     PC->DIR_b.DIR8=0
#define   PC8_OUTL      PC->CLR_b.CLR8=1
#define   PC8_OUTH      PC->SET_b.SET8=1
#define   PC8_READ     (PC->PIN)&0X100


#define   PC9_OUTPUT    PC->DIR_b.DIR9=1
#define   PC9_INPUT     PC->DIR_b.DIR9=0
#define   PC9_OUTL      PC->CLR_b.CLR9=1
#define   PC9_OUTH      PC->SET_b.SET9=1
#define   PC9_READ     (PC->PIN)&0X200


#define   PC10_OUTPUT    PC->DIR_b.DIR10=1
#define   PC10_INPUT     PC->DIR_b.DIR10=0
#define   PC10_OUTL      PC->CLR_b.CLR10=1
#define   PC10_OUTH      PC->SET_b.SET10=1
#define   PC10_READ     (PC->PIN)&0X400

#define   PC11_OUTPUT    PC->DIR_b.DIR11=1
#define   PC11_INPUT     PC->DIR_b.DIR11=0
#define   PC11_OUTL      PC->CLR_b.CLR11=1
#define   PC11_OUTH      PC->SET_b.SET11=1
#define   PC11_READ     (PC->PIN)&0X800


#define   PC12_OUTPUT    PC->DIR_b.DIR12=1
#define   PC12_INPUT     PC->DIR_b.DIR12=0
#define   PC12_OUTL      PC->CLR_b.CLR12=1
#define   PC12_OUTH      PC->SET_b.SET12=1
#define   PC12_READ     (PC->PIN)&0X1000


#define   PC13_OUTPUT    PC->DIR_b.DIR13=1
#define   PC13_INPUT     PC->DIR_b.DIR13=0
#define   PC13_OUTL      PC->CLR_b.CLR13=1
#define   PC13_OUTH      PC->SET_b.SET13=1
#define   PC13_READ     (PC->PIN)&0X2000

#define   PC14_OUTPUT    PC->DIR_b.DIR14=1
#define   PC14_INPUT     PC->DIR_b.DIR14=0
#define   PC14_OUTL      PC->CLR_b.CLR14=1
#define   PC14_OUTH      PC->SET_b.SET14=1
#define   PC14_READ     (PC->PIN)&0X4000

#define   PC15_OUTPUT    PC->DIR_b.DIR15=1
#define   PC15_INPUT     PC->DIR_b.DIR15=0
#define   PC15_OUTL      PC->CLR_b.CLR15=1
#define   PC15_OUTH      PC->SET_b.SET15=1
#define   PC15_READ     (PC->PIN)&0X8000



#define   PD0_OUTPUT    PD->DIR_b.DIR0=1
#define   PD0_INPUT     PD->DIR_b.DIR0=0
#define   PD0_OUTL      PD->CLR_b.CLR0=1
#define   PD0_OUTH      PD->SET_b.SET0=1
#define   PD0_READ     (PD->PIN)&0X01


#define   PD1_OUTPUT    PD->DIR_b.DIR1=1
#define   PD1_INPUT     PD->DIR_b.DIR1=0
#define   PD1_OUTL      PD->CLR_b.CLR1=1
#define   PD1_OUTH      PD->SET_b.SET1=1
#define   PD1_READ     (PD->PIN)&0X02


#define   PD2_OUTPUT    PD->DIR_b.DIR2=1
#define   PD2_INPUT     PD->DIR_b.DIR2=0
#define   PD2_OUTL      PD->CLR_b.CLR2=1
#define   PD2_OUTH      PD->SET_b.SET2=1
#define   PD2_READ     (PD->PIN)&0X04

#define   PD3_OUTPUT    PD->DIR_b.DIR3=1
#define   PD3_INPUT     PD->DIR_b.DIR3=0
#define   PD3_OUTL      PD->CLR_b.CLR3=1
#define   PD3_OUTH      PD->SET_b.SET3=1
#define   PD3_READ     (PD->PIN)&0X08

#define   PD4_OUTPUT    PD->DIR_b.DIR4=1
#define   PD4_INPUT     PD->DIR_b.DIR4=0
#define   PD4_OUTL      PD->CLR_b.CLR4=1
#define   PD4_OUTH      PD->SET_b.SET4=1
#define   PD4_READ     (PD->PIN)&0X10

#define   PD5_OUTPUT    PD->DIR_b.DIR5=1
#define   PD5_INPUT     PD->DIR_b.DIR5=0
#define   PD5_OUTL      PD->CLR_b.CLR5=1
#define   PD5_OUTH      PD->SET_b.SET5=1
#define   PD5_READ     (PD->PIN)&0X20

#define   PD6_OUTPUT    PD->DIR_b.DIR6=1
#define   PD6_INPUT     PD->DIR_b.DIR6=0
#define   PD6_OUTL      PD->CLR_b.CLR6=1
#define   PD6_OUTH      PD->SET_b.SET6=1
#define   PD6_READ     (PD->PIN)&0X40

#define   PD7_OUTPUT    PD->DIR_b.DIR7=1
#define   PD7_INPUT     PD->DIR_b.DIR7=0
#define   PD7_OUTL      PD->CLR_b.CLR7=1
#define   PD7_OUTH      PD->SET_b.SET7=1
#define   PD7_READ     (PD->PIN)&0X80

#define   PD8_OUTPUT    PD->DIR_b.DIR8=1
#define   PD8_INPUT     PD->DIR_b.DIR8=0
#define   PD8_OUTL      PD->CLR_b.CLR8=1
#define   PD8_OUTH      PD->SET_b.SET8=1
#define   PD8_READ     (PD->PIN)&0X100


#define   PD9_OUTPUT    PD->DIR_b.DIR9=1
#define   PD9_INPUT     PD->DIR_b.DIR9=0
#define   PD9_OUTL      PD->CLR_b.CLR9=1
#define   PD9_OUTH      PD->SET_b.SET9=1
#define   PD9_READ     (PD->PIN)&0X200


#define   PD10_OUTPUT    PD->DIR_b.DIR10=1
#define   PD10_INPUT     PD->DIR_b.DIR10=0
#define   PD10_OUTL      PD->CLR_b.CLR10=1
#define   PD10_OUTH      PD->SET_b.SET10=1
#define   PD10_READ     (PD->PIN)&0X400

#define   PD11_OUTPUT    PD->DIR_b.DIR11=1
#define   PD11_INPUT     PD->DIR_b.DIR11=0
#define   PD11_OUTL      PD->CLR_b.CLR11=1
#define   PD11_OUTH      PD->SET_b.SET11=1
#define   PD11_READ     (PD->PIN)&0X800

#define   PD12_OUTPUT    PD->DIR_b.DIR12=1
#define   PD12_INPUT     PD->DIR_b.DIR12=0
#define   PD12_OUTL      PD->CLR_b.CLR12=1
#define   PD12_OUTH      PD->SET_b.SET12=1
#define   PD12_READ     (PD->PIN)&0X1000

#define   PD13_OUTPUT    PD->DIR_b.DIR13=1
#define   PD13_INPUT     PD->DIR_b.DIR13=0
#define   PD13_OUTL      PD->CLR_b.CLR13=1
#define   PD13_OUTH      PD->SET_b.SET13=1
#define   PD13_READ     (PD->PIN)&0X2000


#define   PD14_OUTPUT    PD->DIR_b.DIR14=1
#define   PD14_INPUT     PD->DIR_b.DIR14=0
#define   PD14_OUTL      PD->CLR_b.CLR14=1
#define   PD14_OUTH      PD->SET_b.SET14=1
#define   PD14_READ     (PD->PIN)&0X4000

#define   PD15_OUTPUT    PD->DIR_b.DIR15=1
#define   PD15_INPUT     PD->DIR_b.DIR15=0
#define   PD15_OUTL      PD->CLR_b.CLR15=1
#define   PD15_OUTH      PD->SET_b.SET15=1
#define   PD15_READ     (PD->PIN)&0X8000

